home *** CD-ROM | disk | FTP | other *** search
/ Amiga CD-ROM Collection / Amiga CD-ROM Collection - Auge 4000 and Cactus and Demo Util.iso / auge4000 / 46 / lib / extra / resource.a68k < prev    next >
Text File  |  1990-06-20  |  1KB  |  58 lines

  1.  
  2.  ;
  3.  ;  EXEC resource support
  4.  ;                   4(sp)  8(sp)
  5.  ;    AutoAllocMiscResource(resno, value)
  6.  ;        resno:  MR_SERIALPORT, SERIALBITS, PARALLELPORT, PARALLELBITS
  7.  ;        value:  -1 to allocate, 0 to check
  8.  ;
  9.  ;        returns 0 on success
  10.  ;
  11.  ;    AutoFreeMiscResource(resno)
  12.  ;                  4(sp)
  13.  ;        Free a misc resource you allocated
  14.  ;
  15.  ;    No need to open the misc.resource
  16.  
  17.  
  18.         section text,CODE
  19.  
  20.         xdef    _AutoAllocMiscResource
  21.         xdef    _AutoFreeMiscResource
  22.         xref    _LVOOpenResource
  23.  
  24. _AutoAllocMiscResource:
  25.         move.l  A6,-(sp)
  26.         bsr     OpenMiscResource
  27.         beq     amfail
  28.         move.l  8(sp),D0
  29.         move.l  12(sp),A1
  30.         jsr     -6(A6)
  31.         bra     amret
  32. amfail        moveq.l #-1,D0
  33. amret        move.l  (sp)+,A6
  34.         rts
  35.  
  36. _AutoFreeMiscResource:
  37.         move.l  A6,-(sp)
  38.         bsr     OpenMiscResource
  39.         beq     fmret
  40.         move.l  8(sp),D0
  41.         jsr     -12(A6)
  42. fmret        move.l  (sp)+,A6
  43.         rts
  44.  
  45. OpenMiscResource:
  46.         move.l  4,A6
  47.         lea.l   MiscName,A1
  48.         jsr     _LVOOpenResource(A6)
  49.         move.l  D0,A6
  50.         tst.l   D0
  51.         rts
  52.  
  53. MiscName:   dc.b    "misc.resource",0
  54.  
  55.         END
  56.  
  57.  
  58.